﻿using UnityEngine;

namespace BlockOS.Client
{
    public static class UVConverts
    {
        public static Vector2 GetChunkUV(Rect region, Vector2 localUV)
        {
            return new Vector2(region.x + localUV.x * region.width, region.y + localUV.y * region.height);
        }

        public static Vector2 GetLocalUV(Vector4 uv, Vector4 modelUV)
        {
            return new Vector2(uv.x + modelUV.x * (uv.z - uv.x), uv.y + modelUV.y * (uv.w - uv.y));
        }
    }
}
